package ufrgs.inf.delphos.ui;

import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.HashMap;
import java.util.Map;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
import org.eclipse.emf.common.util.URI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.core.resources.IProject;

public class NewDelphosProjectWizard extends Wizard implements INewWizard {
	
	private WizardNewProjectCreationPage wizardNewProjectCreationPage;
	private IWorkbench workbench;
	private IStructuredSelection selection;

	public NewDelphosProjectWizard() {
		setWindowTitle("New Delphos Project");
		
		wizardNewProjectCreationPage = new WizardNewProjectCreationPage("New Delphos Project");
		wizardNewProjectCreationPage.setTitle("New Delphos Project");
		wizardNewProjectCreationPage.setDescription("Create a new Delphos project resource.");
	}

	@Override
	public void init(IWorkbench workbench, IStructuredSelection selection) {
		// empty
	}

	@Override
	public boolean performFinish() {
		
		IProject project = wizardNewProjectCreationPage.getProjectHandle();
		try {
			project.create(null);
		} catch (CoreException e) {
			e.printStackTrace();
		}

		return true;
	}
	
	@Override
	public void addPages() {
		
		super.addPages();
		this.addPage(wizardNewProjectCreationPage);
	}
	
}
